<!DOCTYPE html>
<html class="ui-page-login">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <script src="__PUBLIC__/home/plugins/layer/layer.js"></script>
    <script src="__PUBLIC__/mui/js/mui.min.js"></script>
    <script src="__PUBLIC__/js/angular.js"></script>
    <script src="__PUBLIC__/common.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/mui/css/mui.css">
    <link rel="stylesheet" href="__PUBLIC__/css/cart.css">
    <style>
        .area {
            margin: 20px auto 0px auto;
        }
        .mui-input-group:first-child {
            margin-top: 20px;
        }
        .mui-input-group label {
            width: 22%;
        }
        .mui-input-row label~input,
        .mui-input-row label~select,
        .mui-input-row label~textarea {
            width: 78%;
        }
        .mui-checkbox input[type=checkbox],
        .mui-radio input[type=radio] {
            top: 6px;
        }
        .mui-content-padded {
            margin-top: 25px;
        }
        .mui-btn {
            padding: 10px;
        }
        .mui-input-row label~input, .mui-input-row label~select, .mui-input-row label~textarea{
            margin-top: 1px;
        }
    </style>
</head>

<body ng-app="myApp" ng-controller="Ctrl" ng-cloak>
<header class="mui-bar mui-bar-nav" style="background: #ef373b;" >
    <a class="mui-icon mui-icon-left-nav mui-pull-left" id="cart-edit" style="color: white" href="/index.php/Home/Index/index"></a>
    <h1 class="mui-title" style="color: white ">代理查询</h1>
</header>
<div class="mui-content">
    <form class="mui-input-group">

        <div class="mui-input-row">
            <label>查询</label>
            <input id='check' type="text" class="mui-input-clear mui-input" placeholder="手机、微信、代理号查询" ng-model="message">
        </div>
    </form>
    <div class="mui-content-padded">
        <button  class="mui-btn mui-btn-block mui-btn-danger" ng-click="check()">查询</button>
    </div>
</div>
<div class="mui-content cart">
    <ul class="mui-table-view">
        <li class="mui-table-view-cell mui-media cart-goods" ng-repeat="x in agent" >
            <a href="javascript:;">
                <img class="media-object mui-pull-left" src="__PUBLIC__/images/banner_bg1.jpg">
                <div class="mui-media-body">
                    <span style="width: 100%;">官方授权合伙人：{{x.name}}</span>
                    <!--<p class='mui-ellipsis'>代理电话：{{x.phone}}</p>-->
                    <p class='mui-ellipsis'>代理级别：{{x.levelname}}</p>
                    <p class='mui-ellipsis'>注册时间：{{x.createtime.substring(0,10)}}</p>
                    <div class="mui-content login-tab mui-pull-right" style="background: white;width: 60%;float: right">
                         <button class="mui-btn   mui-pull-right" style="width: 45%;" ng-click="detail(x.id)">详情</button>
                    </div>
                </div>
            </a>
        </li>

    </ul>
</div>
<script src="__PUBLIC__/mui/js/mui.js"></script>

<script>
    var app = angular.module('myApp', []);
    app.controller('Ctrl', function($scope,$http) {
     $scope.check=function () {
         $http({
             method:'POST',
             data:{check:$scope.message},
             headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
             transformRequest: function(obj) {
                 var str = [];
                 for (var p in obj) {
                     str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
                 }
                 return str.join("&");
             },
             url:"/index.php/Home/index/selagen"
         }).then(function successCallback(response) {
             if(response.data.code==-1){
                 layer.msg(response.data.msg,{time:1000})
             }
             else if(response.data.code==0){
                 $scope.agent=response.data.data
             }
         }, function errorCallback(response) {
         });
     }

        //代理详情
        $scope.detail=function (id) {
            console.log(id)
            window.location.href="/index.php/Home/Index/agenmessage?id="+id;
        }
    })

</script>
</body>

</html>